<script src="./loadImage.js"></script>
<script>
  loadImage('./a.png', function(error, img) {
    if (error) {
      console.error(error)
    } else {
      const image = document.createElement('img')
      image.src = img
      document.body.append(image)
    }
  })
</script>